﻿Imports KOR.Helpers

Namespace BL

    Public Module Brands

#Region "Brands_DML"
        Public Function InsertBrand(dict As Dictionary(Of String, Object)) As Integer
            Return DDA.Insert("Brands", dict)
        End Function

        Public Function UpdateBrand(dict As Dictionary(Of String, Object), BrandID As Integer) As Integer
            Return DDA.Update("Brands", dict, "BrandID=" & BrandID)
        End Function

        Public Function DeleteBrand(ByVal BrandID As Integer) As Integer
            Return DDA.Delete("Brands", "BrandID=" & BrandID, False)
        End Function
#End Region

#Region "Brands_Selection"
        Public Function GetAllBrands() As IDataReader
            Dim sql As String = "SELECT * FROM Brands Order By BrandID DESC"
            Return DDA.SelectData(sql)
        End Function

        Public Function GetBrands(searchFor As String, criteria As String, startRowIndex As Integer, maximumRows As Integer, SortBy As String) As IDataReader
            Dim sql As String
            sql = "SELECT * FROM Brands "

            If SortBy = "" Then SortBy = " CreatedDate Desc"

            Return DDA.SelectDataPaginated(sql, startRowIndex, maximumRows, SortBy)
        End Function

        Public Function GetBrandsCount(searchFor As String, criteria As String) As Integer
            Dim sql As String
            sql = "SELECT * FROM Brands"
            Return DDA.SelectDataCount(sql)
        End Function
#End Region



    End Module
End Namespace